var i = -1;
function setBg(){
	i++;
	if(i % 2 == 0){
		return "tr_bg1";
	}else{
		return "tr_bg";
	}
}
var obj = this.selectSingleNode("DW_ATTRIBUTE");
var idx = 0;
if (obj != null){
	idx = parseInt(obj.childNodes(1).text,10)*(parseInt(obj.childNodes(3).text,10)-1);
}else{
	idx = 0;
}
function count(){
	return ++idx;
}  
var rowInd = 0;
function rowIndex(){
	return ++rowInd;
}
function getRowIndex(){
	return rowInd;
}
function getRadioName(){
	return "rdo_"+rowInd;
}
function formatNoday(nodeName,format){
	var oNode = this.selectSingleNode(nodeName);
	if(oNode == null){
		return "";
	}
	var val = oNode.text; 
	var varNoday = val.substring(0,4); 
	varNoday += "-"; 
	varNoday += val.substring(4,6); 
	return varNoday; 
}
function formatNum(nodeName,format){
	var dw = false;
	var oNode = this.selectSingleNode(nodeName);
	if(oNode == null){
		return "";
	}
	var val = oNode.text;
	try{
		var num;
		if(val=='' || val==null){  
			num='';
		}else{
			format = format.replace(/w/g,'');   
			if (dw && (format != '#,##0') && (format.substring(format.length-1) != '%')){
				format = format + 'w';
			}
			if(format.substring(format.length-1)=='w'){
				val=parseFloat(val)/10000;format = format.substring(0,format.length-1);
			}
			num =  formatNumber(val,format);
			var len = num.length;
			if(len != 0){
				if(num.charAt(len - 1) == '.'){
					num = num.substring(0,len-1);
				}else if(num.charAt(len - 1) == '%' && num.charAt(len - 2) == '.'){
						num = num.substring(0,len-2)+"%";
				}
			}
		}
		return num;
	}catch(e){
		return val;
	}
}
function getFontColor(nodeName){
	var oNode = this.selectSingleNode(nodeName); 
	if(oNode == null){
		return "";
	}
	var val = oNode.text; 
	try{
		var color="green";
		if(val==1){
			color="red";
		}else if(val==-1){
			color="yellow";
		}
		return color;
	}catch(e){
		return "";
	}
}